package com.yfp.goods.controller;

import com.yfp.common.core.domain.R;
import com.yfp.common.core.web.controller.BaseController;
import com.yfp.goods.service.ComboDetailImgService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;


/**
 * 套餐详情图片表(ComboDetailImg)表控制层
 *
 *
 * @since 2023-12-20 22:21:53
 */
@Tag(name = "套餐详情图片")
@RestController
@RequestMapping("comboDetailImg")
public class ComboDetailImgController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private ComboDetailImgService comboDetailImgService;

    @GetMapping("{comboId}")
    @Operation(summary = "通过套餐id 查询图片列表 list")
    public R queryComboDetailImg(@PathVariable String comboId) {
        return R.ok(comboDetailImgService.queryComboDetailImg(comboId));
    }


    @GetMapping("/getResourceUrl")
    @Operation(summary = "通过套餐id 查询图片列表 list")
    public R<String> getResourceUrl(@RequestParam("resourceType") Integer resourceType,@RequestParam("resourceId") String resourceId) {
        return R.ok(comboDetailImgService.getResourceUrl(resourceType, resourceId));
    }


    @Operation(summary = "取消资源关联")
    @GetMapping("del/{id}")
    public R delete(@PathVariable String id) {
        return this.comboDetailImgService.delete(id) ? R.ok() : R.fail();
    }
}

